<?php
class Master
{
	const DEFAULT_ID_LENGTH = 6;
	static function getUnusedId()
	{
		return mt_rand(pow(10, self::DEFAULT_ID_LENGTH-1),
				pow(10, self::DEFAULT_ID_LENGTH)-1);
	}
}

class Page
{
	static function head($return = false)
	{
		?>
<!DOCTYPE html><html><head>
<title>MASTER · 维客读</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" media="screen" href="css/main.css" />
</head><body>

<div id="page_head"><div class="right"><input type=button value="下载 WEEKDO MASTER 客户端"></div><b>&lt; MASTER · 维客读 &gt;</b></div>
<div id="page_body">
		<?php
	}
	
	static function tail($return = false)
	{
		?>
</div>
<div id="page_tail"><hr />@ 2011 - by <a href="mailto:mail.langrui@gmail.com">Solomon</a></div></body></html>
		<?php
	}
	
	static function birthdayInput($return = false)
	{
		$html = '';

		// year
		$html .= '<select>';
		for ($i=1930; $i<=2000; $i++)
		{
			if ($i==1980)
			{
				$html .= '<option selected value='.$i.' >'.$i.'</option>';
			}
			else
			{
				$html .= '<option value='.$i.' >'.$i.'</option>';
			}
		}
		$html .= '</select>';

		// month
		$html .= '<select>';
		for ($i=1; $i<=12; $i++)
		{
			$html .= '<option value='.$i.' >'.$i.'</option>';
		}
		$html .= '</select>';

		// day
		$html .= '<select>';
		for ($i=1; $i<=31; $i++)
		{
			$html .= '<option value='.$i.' >'.$i.'</option>';
		}
		$html .= '</select>';

		if ($return)
		{
			return $html;
		}
		else
		{
			echo $html;
		}
	}
}
